<script setup>
import { onMounted, nextTick, ref, reactive, watch } from 'vue'
import HeaderView from './HeaderView.vue';
import { userInfo } from '../stores/default'
import { useRouter } from 'vue-router'
const router = useRouter()


const urlGo = import.meta.env.VITE_backurl_go

const user = userInfo()

onMounted(() => {
  // 获取sessionStorage中的用户信息
  // let userId = sessionStorage.getItem('userId')
  // axios({
  //   method: 'get',
  //   url: urlGo + '/wz/getUser',
  //   params: {
  //     userId: userId
  //   },
  // }).then(res => {
  //   let rightSet = new Set()
  //   res.data.data?.role?.forEach(role => {
  //     role.right.forEach(right => {
  //       right.router.split(',').forEach(v => {
  //         rightSet.add(v)
  //       })
  //     })
  //   })
  //   let rightArr = Array.from(rightSet)
  //   user.setValue({
  //     ...res.data.data,
  //     rightArr: rightArr
  //   })
  // })

  // 开启定时器，监听鼠标移动，超过一定时间，退出登录
  // let timer = null
  // timer = setTimeout(() => {
  //   ElMessage.warning('登录超时，请重新登录')
  //   sessionStorage.clear()
  //   router.push('/login')
  // }, 1000*60*10)
  // document.onmousemove = function () {
  //   clearTimeout(timer)
  //   timer = setTimeout(() => {
  //     ElMessage.warning('登录超时，请重新登录')
  //     sessionStorage.clear()
  //     router.push('/login')
  //   }, 1000*60*10)
  // }
})
</script>

<template>
  <div class="homeView">
    <!-- <keep-alive :include="IndexView">
      <RouterView />
    </keep-alive> -->
    <!-- <HeaderView /> -->
    <router-view v-slot="{ Component }">
      <!-- <keep-alive> -->
      <component :is="Component" />
      <!-- </keep-alive> -->
    </router-view>
  </div>
</template>

<style lang='less' scoped>
.homeView {
  // position: fixed;
  width: 100%;
  // padding-top: var(--nv-height);
}
</style>